import moduleRegist from '@/utils/moduleRegist';
import {
  module as reconcilepayerModule
} from './module';
import {
  module as reconcilepayerItemsModule
} from '../reconcilepayerItems/module';

const Layout = resolve => {
  require(['./Layout'], resolve);
};

const ClearReconciliation = resolve => {
  require(['./ClearReconciliation'], resolve);
};

const ClearReconciliationDetail = resolve => {
  require(['./ClearReconciliationDetail'], resolve);
};

const ClearReconciliationDifference = resolve => {
  require(['./ClearReconciliationDifference'], resolve);
};

const PayReconciliation = resolve => {
  require(['./PayReconciliation'], resolve);
};

const PayReconciliationDetail = resolve => {
  require(['./PayReconciliationDetail'], resolve);
};

const PayReconciliationDifference = resolve => {
  require(['./PayReconciliationDifference'], resolve);
};

export default [
  /** 配置管理路由 */
  {
    path: 'reconcileCenter',
    redirect: 'reconcileCenter/list',
    component: Layout,
    meta: {
      title: '对账中心',
      name: '对账中心',
      permission: '',
      componentName: 'ReconcilepayerLayout',
      keepAlive: true,
      icon: '',
      show: false
    },
    beforeEnter: (to, from, next) => {
      moduleRegist(reconcilepayerModule);
      moduleRegist(reconcilepayerItemsModule);
      next();
    },
    children: [{
      path: 'list',
      component: PayReconciliation,
      meta: {
        title: '支付对账查询',
        name: '支付对账查询',
        breadcrumb: '支付对账查询',
        permission: 'invoice:taxpayer:query',
        keepAlive: true,
        componentName: 'ReconcilepayerListView',
        icon: ''
      }
    },
    {
      path: 'payReconciliationDetail',
      component: PayReconciliationDetail,
      meta: {
        title: '支付对账明细查询',
        name: '支付对账明细查询',
        breadcrumb: '支付对账明细查询',
        permission: 'invoice:taxpayer:add',
        show: true,
        keepAlive: true,
        componentName: 'ReconcilepayerAddView',
        icon: ''
      }
    },
    {
      path: 'payReconciliationDifference',
      component: PayReconciliationDifference,
      meta: {
        title: '支付对账差异',
        name: '支付对账差异',
        breadcrumb: '支付对账差异',
        permission: 'invoice:taxpayer:detail',
        show: true,
        keepAlive: true,
        componentName: 'ReconcilepayerDetailView',
        icon: ''
      }
    },
    {
      path: 'ClearReconciliation',
      component: ClearReconciliation,
      meta: {
        title: '清分对账查询',
        name: '清分对账查询',
        breadcrumb: '清分对账查询',
        permission: 'invoice:taxpayer:add',
        show: true,
        keepAlive: true,
        componentName: 'ReconcilepayerAddView',
        icon: ''
      }
    },
    {
      path: 'ClearReconciliationDetail',
      component: ClearReconciliationDetail,
      meta: {
        title: '清分对账明细查询',
        name: '清分对账明细查询',
        breadcrumb: '清分对账明细查询',
        permission: 'invoice:taxpayer:detail',
        show: true,
        keepAlive: true,
        componentName: 'ReconcilepayerDetailView',
        icon: ''
      }
    },
    {
      path: 'ClearReconciliationDifference',
      component: ClearReconciliationDifference,
      meta: {
        title: '清分对账差异',
        name: '清分对账差异',
        breadcrumb: '清分对账差异',
        permission: 'invoice:taxpayer:add',
        show: true,
        keepAlive: true,
        componentName: 'ReconcilepayerAddView',
        icon: ''
      }
    }]
  }
];
